package demo1;
//这是一个测试类
public class Test {
    public static void test1(Animal animal){
        animal.eat();
    }
    public static void test2(IRunning iRunning){
        iRunning.run();
    }
    public static void test3(ISwimming iSwimming){
        iSwimming.swim();
    }
    public static void test4(IFlying iFlying){
        iFlying.fly();
    }

    public static void main(String[] args) {
        Bird bird = new Bird("小鸟",5);

        Dog dog = new Dog("小狗", 3);

        test1(bird);
        test2(bird);
//        test3(bird);//err 鸟不能游泳
        test4(bird);
        test1(dog);
        test2(dog);
        test3(dog);
//        test4(dog);//err狗不能飞
        Robert robert = new Robert();
        test2(robert);
//        test1(robert);//err，机器人不是动物
        test3(robert);
        test4(robert);
    }
}



/*
interface  IEatting {
    void eat();
}
interface IAmphibious extends IRunning,ISwimming,IEatting {
    //...

}
class Frog implements IAmphibious {
    @Override
    public void run() {

    }

    @Override
    public void swim() {

    }

    @Override
    public void eat() {

    }

}
 */
